package modifycomponent;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class JImageViewer extends JPanel {

	private static final long serialVersionUID = 0xAC1L;
	private String url = "";

	public JImageViewer() {
		url = "src/icons/large_token_icon.png";
		this.setOpaque(false);
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Override
	public void paintComponent(Graphics g) {
		Dimension d = getSize();
		Image image = new ImageIcon(url).getImage();

		g.drawImage(image, 0, 0, d.width, d.height, null);
		super.paintComponent(g);
	}

}
